import { useEffect } from 'react'
import { Navigate, useRoutes } from 'react-router-dom'
import LazyLoad from '@/components/LazyLoad'
// import AuthCompoent from '@/components/AuthCompoent'

import home from './modules/home'
import role from './modules/role'
import permission from './modules/permission'
import user from './modules/user'
const dynamicRoutes = [home,
    role,
    permission,
    user,]
function MyRouter() {
    useEffect(() => {
        
    }, [])
    const element = useRoutes([
        ...dynamicRoutes,
        {
            path: '/login',
            element: LazyLoad('login/Login')
        },
        {
            path: '/',
            element: <Navigate to='/login' />
        },
        {
            path: '*',
            element: LazyLoad('notFound/NotFound')
        },
    ])

    return element
}

export default MyRouter